﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;

namespace Halation.Extensions
{
    public static class ReflectionEx
    {
        /// <summary>
        /// 利用方法信息创建委托
        /// </summary>
        /// <typeparam name="TDelegate">委托类型</typeparam>
        /// <param name="method">方法信息</param>
        /// <returns>委托</returns>
        public static TDelegate CreateDelegate<TDelegate>(this MethodInfo method)
        {
            return (TDelegate)(object)Delegate.CreateDelegate(typeof(TDelegate), method);
        }


    }
}
